{extend name="layout/layout_simple" /}
{block name="content"}

<form style="margin: 30px 0;">
    <input type="hidden" name="id" value="{$role.id}">
    <h5 style="text-align: center">
        [ {$role.name} ] 的权限
    </h5>

    <table>
        <tbody>
        {volist name='list.0._child' id="n"}
        <tr>
            <td width="150" style="padding: 10px; border-bottom: 1px solid #fff; padding-left: 30px;">
                <label class="m-t-10" style="min-width: 100px;">
                    <input type="checkbox" class="minimal" name="node[]" value="{$n.id}" {in name="n.id" value="$nodes"}checked="checked" checked{/in}>
                    {$n.title}
                </label>
            </td>
            <td style="padding: 10px; border-bottom: 1px solid #fff;">
                <div class="form-group" style="margin-bottom: 0; ">
                    {volist name="n._child" id = "v"}
                    <label class="m-t-10" style="min-width: 100px;">
                        <input type="checkbox" class="minimal" name="node[]" value="{$v.id}" {in name="v.id" value="$nodes"}checked="checked" checked{/in}>
                        {$v.title}
                    </label>

                    {/volist}
                </div>
            </td>
        </tr>
        {/volist}

        </tbody>
    </table>

    <div style="text-align: center">
        <button type="button" onclick="doSubmit()" class="btn btn-primary mt-1 mb-0">提 交</button>
    </div>

</form>

{/block}
{block name="script"}
<script>
  function doSubmit() {
    ajaxRequest("{:url('auth/editrolenode')}", $('form').serialize(), function (res) {
      layer.msg(res.msg, {icon: 1, time: 1000}, function (res) {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
        parent.location.reload();
      });
    }, 'POST');
  }
</script>
{/block}
